import { Button } from "antd"
import styled from "styled-components"
import { connect } from 'react-redux'
import * as TYPES from '../store/action-types'
const DemoBox = styled.div`
    width: 500px;
    margin: 0 auto;
`
function Demo(props) {
    let { num, dispatch } = props
    return <DemoBox>
        <span>{num}</span>
        <br />
        <Button type="primary" onClick={() => {
            dispatch({ type: TYPES.DEMO,payload:10 })
        }}>点我新增</Button>
        <Button type="primary" danger onClick={()=>{
            dispatch({
                type:TYPES.DEMO+'@SAGA@',
                payload:5
            })
        }}>点我异步新增</Button>
    </DemoBox>
}
export default connect(state => state.demo)(Demo) 